<template>
    <aside class="sidebar">
        <el-menu
            :default-active="activedIndex"
            router
            class="menu">
            <el-menu-item index="/subjects">
                <i class="iconfont el-icon-document-add"></i>
                <span slot="title">配置科目</span>
            </el-menu-item>
            <el-menu-item index="/companies">
                <i class="iconfont icon-document"></i>
                <span slot="title">客户档案</span>
            </el-menu-item>
            <el-submenu index="/auto">
                <template slot="title">
                    <i class="iconfont icon-smart"></i>
                    <span>财务自动化</span>
                </template>
                <el-menu-item index="/upload-info/list">信息上传</el-menu-item>
                <el-menu-item index="/check-list">信息核对</el-menu-item>
                <el-menu-item index="/smart-bill">智能做账</el-menu-item>
                <el-menu-item index="/roll-back">状态重置</el-menu-item>
            </el-submenu>
            <el-submenu index="/one-key-bill">
                <template slot="title">
                    <i class="iconfont icon-one-key"></i>
                    <span>一键报税</span>
                </template>
                <el-menu-item index="/one-key-bill">企业增值税</el-menu-item>
                <el-menu-item index="/one-key-bill/corporate-income-tax">企业所得税</el-menu-item>
                <el-menu-item index="/one-key-bill/people-income-tax">个人所得税</el-menu-item>
                <el-menu-item index="/one-key-bill/people-manage-tax">个人经营所得税</el-menu-item>
                <el-menu-item index="/one-key-bill/declare-to-void">申报作废</el-menu-item>
                <el-menu-item index="/one-key-bill/tax-declare-certificate-download">税金缴纳及凭证下载</el-menu-item>
            </el-submenu>
            <!-- 风控系统还未开发完毕 -->
            <el-submenu v-if="false" index="/risk-sys">
                <template slot="title">
                    <i class="iconfont icon-fengxian"></i>
                    <span>风险系统</span>
                </template>
                <el-menu-item index="/risk-sys/bills">开票金额风险</el-menu-item>
                <el-menu-item index="/risk-sys/income-tax">所得税风险</el-menu-item>
            </el-submenu>

            <el-menu-item index="/history">
                <i class="iconfont icon-history"></i>
                <span slot="title">账薄查询</span>
            </el-menu-item>
        </el-menu>
    </aside>
</template>

<script>
export default {
    data() {
        return {
            activedIndex: null
        };
    },

    watch: {
        $route() {
            let ps = this.$route.path.split('/');

            if(ps.length >= 4) {
               ps.splice(3, ps.length)
            }
            this.activedIndex = ps.join('/');
        }
    },

    mounted() {
    },
    methods: {
    }
}
</script>
<style lang="less">
.sidebar {
    flex: 0 0 150px;
    background: #fff;
    .menu {
        height: 100%;
        padding-top: 20px;
    }
    .el-submenu {
        .el-menu {
            padding-left: 5px;
        }
        .el-menu-item {
            font-size: 12px;
            padding: 0 0 0 50px;
            min-width: auto;
        }
        .el-icon-arrow-down {
            margin-top: -4px;
        }
    }
    .icon-upload,
    .icon-one-key {
        font-size: 20px;
    }
}
</style>
